package com.example.spi.impl;

import com.example.spi.DatabaseDriver;

/**
 * PostgreSQL数据库驱动实现
 */
public class PostgreSQLDriver implements DatabaseDriver {
    
    @Override
    public String getDriverName() {
        return "PostgreSQL Driver";
    }
    
    @Override
    public String connect(String url) {
        if (!acceptsURL(url)) {
            throw new IllegalArgumentException("不支持的URL: " + url);
        }
        return "成功连接到PostgreSQL数据库: " + url;
    }
    
    @Override
    public boolean acceptsURL(String url) {
        return url != null && url.startsWith("jdbc:postgresql://");
    }
}

